<!--tvm票款差异协查-->
<template>
  <div class="JieZhangDanAndSCCengji HuikuiInfo el-card is-always-shadow el-card__body">
    <el-dialog
      title="操作回馈信息"
      :visible.sync="dialogVisible"
      @close="closed"
      width="950px">
      <div style="line-height: 40px;background-color: #fcf7f7;padding-left: 15px">
        <span>线路：</span><span>{{getLineName(formData.lineCode)}}</span>
        <span style="margin-left: 20px">站点：</span><span>{{getStationName(formData.lineCode,formData.stationCode)}}</span>
        <span style="margin-left: 20px">TVM编号：</span><span>{{formData.tvmOrder}}</span>
        <span style="margin-left: 20px"> 收入日期：</span><span>{{formData.settleTime}}</span>
        <span style="margin-left: 20px"> 支付方式：</span><span>现金</span>
      </div>
      <avue-form v-if="isReload" class="JieZhangDanAndSCCengjiForm" :option="option" v-model="formData" @submit="handleSubmit">
        <template slot-scope="{row}" slot="type">
          <span>{{row.type}}</span>
        </template>
        <template slot-scope="{row}" slot="saleAmount">
          <span>{{fenExYuangettoFixed(row,'saleAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="saleAmountCY">
          <span>{{ fenExYuangettoFixed(row,'saleAmountCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="depositAmount">
          <span>{{fenExYuangettoFixed(row,'depositAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="depositAmountCY">
          <span>{{fenExYuangettoFixed(row,'depositAmountCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="errorRefundAmount">
          <span>{{ fenExYuangettoFixed(row,'errorRefundAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="errorRefundAmountCY">
          <span>{{fenExYuangettoFixed(row,'errorRefundAmountCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="sumCY">
          <span>{{fenExYuangettoFixed(row,'sumCY')}}</span>
        </template>

        <template slot-scope="{row}" slot="beSaleAmount">
          <span>{{ fenExYuangettoFixed(row,'beSaleAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="replySaleMoney">
          <span>{{fenExYuangettoFixed(row,'replySaleMoney')}}</span>
        </template>
        <template slot-scope="{row}" slot="replySaleMoneyCY">
          <span>{{ fenExYuangettoFixed(row,'replySaleMoneyCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="beDepositAmount">
          <span>{{fenExYuangettoFixed(row,'beDepositAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyRechargeMoney">
          <span>{{ fenExYuangettoFixed(row,'replyRechargeMoney')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyRechargeMoneyCY">
          <span>{{fenExYuangettoFixed(row,'replyRechargeMoneyCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="beErrorRefundAmount">
          <span>{{ fenExYuangettoFixed(row,'beErrorRefundAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyErrorReturnMoney">
          <span>{{fenExYuangettoFixed(row,'replyErrorReturnMoney')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyErrorReturnMoneyCY">
          <span>{{fenExYuangettoFixed(row,'replyErrorReturnMoneyCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="replySupplementMoney">
          <span>{{fenExYuangettoFixed(row,'replySupplementMoney')}}</span>
        </template>
        <template slot-scope="scope" slot="jdReplyReason">
          <el-select disabled v-model="jdReplyReason" :size="size" placeholder="请选择" style="width: 150px" >
            <el-option
              v-for="(item,index) in electromeReasons"
              :key="index"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </template>
        <template slot-scope="scope" slot="qfReplyReason">
          <el-select disabled v-model="qfReplyReason" :size="size" placeholder="请选择" style="width: 150px" >
            <el-option
              v-for="(item,index) in electromeReasons"
              :key="index"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </template>
        <template slot-scope="scope" slot="menuForm" >
          <el-button type="primary" @click="handleSubmit" v-if="showType==3">一键替换</el-button>
          <el-button  @click="closed" >返回</el-button>
        </template>
      </avue-form>
    </el-dialog>
  </div>
</template>


<script>
  import {getForm, postForm} from '@/api/gen/gen'
  import ExportJsonExcel from "js-export-excel";
  import {clearSelect, electromeReasons,getLineName,getStationName, qianxiangType,fenExYuangettoFixed} from "../../../../../../../api/subwayRat/commonCheck";
  import {
    getSwAuTvmCashAmountHierarchyDifferenceList,
    cols1,
    cols2,
    getMondifyData1, replaceSwAuTvmAmountDefference, getMondifyData2
  } from "../../../../../../../api/subwayRat/TVMRevenueVarianceAudit.TvmChaYiDXC/tvmCengJiCYXC/tvmXianJinCengJiCYDXY/JieZhangDanAndSCCengji";

  export default {
    components:{
    },
    data() {
      return {
        jdReplyReason:'',
        qfReplyReason:'',
        electromeReasons:[],
        isReload:true,
        showType:1,
        compareType:"",
        replaceStatus:1,
        dialogVisible:true,
        formData:{
        },
        option:{

        },
        tableDataSource:''//页面数据源
    }
    },
    created() {
      this.electromeReasons = electromeReasons();
    },
    methods: {
      getLineName,
      getStationName,
      fenExYuangettoFixed,
      handleSubmit(){
        replaceSwAuTvmAmountDefference({ids:this.formData.id,tableDataSource:this.tableDataSource}).then(res=>{
          if(res.data.code==0){
            this.$message.success("操作成功！");
            this.closed();
            this.$parent.getList();
            clearSelect(this.$parent.$refs.TvmTicketCYXC)
          }else{
            this.$message.error(res.data.msg);
          }
        })
      },
      recallShow(id,row,showType,replaceStatus){
        this.showType=showType;
        this.replaceStatus=replaceStatus;
        this.getOption();
        this.formData={}
        Object.assign(this.formData,row);
        let mondify1=getMondifyData1(row);
        let mondify2=getMondifyData2(row);
        this.formData.dynamic=mondify1;
        this.formData.dynamic2=mondify2;
        this.jdReplyReason = row.jdReplyReason;
        this.qfReplyReason = row.qfReplyReason;
        this.compareType=row.compareType;
        // getSwAuTvmCashAmountHierarchyDifferenceList({relationid:id}).then((res)=>{
        //   if(res.data.code!=0){
        //       this.$message.error("获取数据失败！");
        //       return;
        //   }
        //   Object.assign(this.formData,res.data.data[0]); //
        //   console.log(this.formData)
        // }).catch((e)=>{
        //   this.$message.error("获取数据失败！");
        // })
      },
      closed(){
        this.dialogVisible=false;
        this.$parent.isShowDia=false;
      },
      getOption(){

        let group1={
          icon:'',
          sortable:true,
          label: '层级差异信息',
          // collapse:false,
          prop: 'group1',
          indexLabel:"#",
          column: [{
            label: '',
            prop: 'dynamic',
            type: 'dynamic',
            span:24,
            children: {
              addBtn:false,
              delBtn:false,
              sortable:true,
              index:false,
              indexLabel:"#",
              align: 'center',
              headerAlign: 'center',
              column: cols1
            }
          }
          ]
        };
        let group2={
          icon:'',
          sortable:true,
          label: '层级差异协查与回馈',
          // collapse:false,
          prop: 'group2',
          indexLabel:"#",
          column: [{
            label: '',
            prop: 'dynamic2',
            type: 'dynamic',
            span:24,
            children: {
              addBtn:false,
              delBtn:false,
              sortable:true,
              index:false,
              indexLabel:"#",
              align: 'center',
              headerAlign: 'center',
              column: cols2
            }
          }
          ]
        };

        let group3={
          icon:'',
          label: '',
          // collapse:false,
          prop: 'group3',
          display: true,
          column: [{
            label: '归属机电专业回馈差异原因',
            prop: 'jdReplyReason',
            labelWidth:200,
            disabled: true,
            type:'select',
            formslot:true,
            display: true,
          },
            {
              label: '机电专业详细描述',
              prop: 'jdReplyDetail',
              type: 'textarea',
              labelWidth:150,
              disabled: true,
              display: true,
            },
            {
              label: '清分管理人员回馈差异原因',
              prop: 'qfReplyReason',
              labelWidth:200,
              disabled: true,
              type:'select',
              formslot:true,
              display: true,
            },
            {
              label: '清分管理人员详细描述',
              prop: 'qfReplyDetail',
              type: 'textarea',
              labelWidth:150,
              disabled: true, //回馈过的和替换过的紧张修改
              display: true,
            },
          ]
        };

        this.option={
          submitBtn:false,
          emptyBtn:false,
          span:12,
          group:[]
        } ;
        this.option.group.push(group1);
        if(this.showType==3){
          this.option.group.push(group2);
          this.option.group.push(group3);
        }else if(this.showType!=3){
        }
        this.isReload=false;
        this.$nextTick(()=>{
          this.isReload=true;
        })
      }
    },
    mounted() {

    }
  }
</script>
<style lang="scss">
  .JieZhangDanAndSCCengji{
    .JieZhangDanAndSCCengjiForm{
      .avue-group[index='1']{
        .el-form-item{
          min-width: 450px;
        }
        .avue-form__row{
          width: 100%;
        }
      }
      .avue-group[index='2']{
        .el-form-item{
          min-width: 450px;
        }
        .avue-form__row{
          width: 100%;
        }
      }
      .avue-group[index='4']{
        .el-form-item{
          min-width: 450px;
        }
        .avue-form__row{
          width: 70%;
        }
      }
    }
  }

</style>
